\(\int (a+b \cot (x))^n \csc ^2(x) \, dx\) [23]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 20 \[ \int (a+b \cot (x))^n \csc ^2(x) \, dx=-\frac {(a+b \cot (x))^{1+n}}{b (1+n)} \]

[Out]

-(a+b*cot(x))^(1+n)/b/(1+n)

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {3587, 32} \[ \int (a+b \cot (x))^n \csc ^2(x) \, dx=-\frac {(a+b \cot (x))^{n+1}}{b (n+1)} \]

[In]

Int[(a + b*Cot[x])^n*Csc[x]^2,x]

[Out]

-((a + b*Cot[x])^(1 + n)/(b*(1 + n)))

Rule 32

Int[((a_.) + (b_.)*(x_))^(m_), x_Symbol] :> Simp[(a + b*x)^(m + 1)/(b*(m + 1)), x] /; FreeQ[{a, b, m}, x] && N
eQ[m, -1]

Rule 3587

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(b*f), Subst
[Int[(a + x)^n*(1 + x^2/b^2)^(m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && NeQ[a^2 + b
^2, 0] && IntegerQ[m/2]

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int (a+x)^n \, dx,x,b \cot (x)\right )}{b} \\ & = -\frac {(a+b \cot (x))^{1+n}}{b (1+n)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.23 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.00 \[ \int (a+b \cot (x))^n \csc ^2(x) \, dx=-\frac {(a+b \cot (x))^{1+n}}{b (1+n)} \]

[In]

Integrate[(a + b*Cot[x])^n*Csc[x]^2,x]

[Out]

-((a + b*Cot[x])^(1 + n)/(b*(1 + n)))

Maple [A] (verified)

Time = 3.42 (sec) , antiderivative size = 21, normalized size of antiderivative = 1.05

method result size
derivativedivides \(-\frac {\left (a +b \cot \left (x \right )\right )^{1+n}}{b \left (1+n \right )}\) \(21\)
default \(-\frac {\left (a +b \cot \left (x \right )\right )^{1+n}}{b \left (1+n \right )}\) \(21\)

[In]

int((a+b*cot(x))^n*csc(x)^2,x,method=_RETURNVERBOSE)

[Out]

-(a+b*cot(x))^(1+n)/b/(1+n)

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.90 \[ \int (a+b \cot (x))^n \csc ^2(x) \, dx=-\frac {{\left (b \cos \left (x\right ) + a \sin \left (x\right )\right )} \left (\frac {b \cos \left (x\right ) + a \sin \left (x\right )}{\sin \left (x\right )}\right )^{n}}{{\left (b n + b\right )} \sin \left (x\right )} \]

[In]

integrate((a+b*cot(x))^n*csc(x)^2,x, algorithm="fricas")

[Out]

-(b*cos(x) + a*sin(x))*((b*cos(x) + a*sin(x))/sin(x))^n/((b*n + b)*sin(x))

Sympy [F]

\[ \int (a+b \cot (x))^n \csc ^2(x) \, dx=\int \left (a + b \cot {\left (x \right )}\right )^{n} \csc ^{2}{\left (x \right )}\, dx \]

[In]

integrate((a+b*cot(x))**n*csc(x)**2,x)

[Out]

Integral((a + b*cot(x))**n*csc(x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.00 \[ \int (a+b \cot (x))^n \csc ^2(x) \, dx=-\frac {{\left (b \cot \left (x\right ) + a\right )}^{n + 1}}{b {\left (n + 1\right )}} \]

[In]

integrate((a+b*cot(x))^n*csc(x)^2,x, algorithm="maxima")

[Out]

-(b*cot(x) + a)^(n + 1)/(b*(n + 1))

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 41 vs. \(2 (20) = 40\).

Time = 0.28 (sec) , antiderivative size = 41, normalized size of antiderivative = 2.05 \[ \int (a+b \cot (x))^n \csc ^2(x) \, dx=-\frac {\left (-\frac {b \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, a \tan \left (\frac {1}{2} \, x\right ) - b}{2 \, \tan \left (\frac {1}{2} \, x\right )}\right )^{n + 1}}{b {\left (n + 1\right )}} \]

[In]

integrate((a+b*cot(x))^n*csc(x)^2,x, algorithm="giac")

[Out]

-(-1/2*(b*tan(1/2*x)^2 - 2*a*tan(1/2*x) - b)/tan(1/2*x))^(n + 1)/(b*(n + 1))

Mupad [B] (verification not implemented)

Time = 12.69 (sec) , antiderivative size = 43, normalized size of antiderivative = 2.15 \[ \int (a+b \cot (x))^n \csc ^2(x) \, dx=\left \{\begin {array}{cl} -\frac {\ln \left (a+\frac {b}{\mathrm {tan}\left (x\right )}\right )}{b} & \text {\ if\ \ }n=-1\\ -\frac {{\left (a+\frac {b}{\mathrm {tan}\left (x\right )}\right )}^{n+1}}{b\,\left (n+1\right )} & \text {\ if\ \ }n\neq -1 \end {array}\right . \]

[In]

int((a + b*cot(x))^n/sin(x)^2,x)

[Out]

piecewise(n == -1, -log(a + b/tan(x))/b, n ~= -1, -(a + b/tan(x))^(n + 1)/(b*(n + 1)))